//
//  ClockViewController.m
//  View Switch
//
//  Created by User on 7/2/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "ClockViewController.h"


@implementation ClockViewController

@synthesize day;
@synthesize time;
@synthesize testing;


- (void)viewDidLoad {
	
    [super viewDidLoad];
	
	[self runningClock];
	timer = [NSTimer scheduledTimerWithTimeInterval:(1.0) target:self selector:@selector(runningClock) userInfo:nil repeats:YES];
}

-(void)runningClock{
	
	NSDate *date = [NSDate date];
	
	NSDateFormatter *clockTime = [[NSDateFormatter alloc] init];
	[clockTime setTimeStyle:NSDateFormatterMediumStyle];
	time.text = [clockTime stringFromDate:date];
	
	NSDateFormatter *clockDay = [[NSDateFormatter alloc] init];
	[clockDay setDateStyle:NSDateFormatterLongStyle];
	day.text = [clockDay stringFromDate:date];
	
	NSUserDefaults *clockOptions = [NSUserDefaults standardUserDefaults];
	NSString *myString = [clockOptions stringForKey:@"Name"];
	//int myInt =[clockOptions integerForKey:@"Age"];
	testing.text = [NSString stringWithFormat:@"%@", myString];
	
}


/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
	[day release];
	[time release];
    [super dealloc];
}


@end
